<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">特卖商品管理</a></li>
			<li><a href="{:U('Sale/add')}" target="_self">添加商品</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Sale/index')}">
			特卖商品分类：
			<select name="shop_cat_id" style="width: 160px;">
				<option value='0'>全部</option>
				<foreach name="shopcat" item="vo">
					<php>$cid_select=$vo['cid']==$shop_cat_id?"selected":"";</php>
					<option value='{$vo.cid}' {$cid_select}>{$vo.cat_name}</option>
				</foreach>
			</select> &nbsp;&nbsp;
			时间：
			<input type="text" name="start_time" class="js-datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
			<input type="text" class="js-datetime" name="end_time" value="{$formget.end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
			商品名称：
			<input type="text" name="shop_title" style="width: 200px;" value="{$formget.shop_title|default=''}" placeholder="请输入商品名称...">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:U('Sale/index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="" method="post">
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Sale/listorders')}">排序</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('Sale/delete')}" data-subcheck="true" data-msg="您确定删除吗？">删除</button>
			</div>
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th width="50">排序</th>
						<th width="50">ID</th>
						<th>商品名称</th>
						<th width="160">图片</th>
						<th width="160">商品分类</th>
						<th width="50">上传人</th>
						<th>原价</th>
						<th>现价</th>
						<th width="50">库存</th>
						<th width="50">销量</th>
						<th width="120">发布时间</th>
						<th width="50">状态</th>
						<th width="120">操作</th>
					</tr>
				</thead>
				<foreach name="shops" item="vo">
				<tr>
					<td>
						<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}">
					</td>
					<td><input name="listorders[{$vo.id}]" class="input input-order" type="text" size="5" value="{$vo.listorder}"></td>
                    <td><b>{$vo.id}</b></td>
					<td>{$vo.shop_title}</td>
					<td>
						<php>$smeta=json_decode($vo['smeta'],true);</php>
						<if condition="empty($smeta['thumb'])">
							<img src="__TMPL__Public/assets/images/default-thumbnail.png" width="135" style="cursor: hand"/>
							<else />
							<img src="{:sp_get_image_preview_url($smeta['thumb'])}" width="135" style="cursor: hand; height: 113px;"/>
						</if>
					</td>
					<td>{$vo.cat_name}</td>
					<td>{$vo.user_nicename|default=$vo.user_login}</td>
					<td>{$vo.shop_yprice}</td>
					<td>{$vo.shop_price}</td>
					<td>{$vo.shop_stock}</td>
					<td>{$vo.shop_sales}</td>
					<td>{:date('Y-m-d H:i',strtotime($vo['shop_date']))}</td>
					<td>
							<if condition="$vo.shop_status eq 1">
								<a data-toggle="tooltip" title="已上架"><i class="fa fa-arrow-up"></i></a>
							<else/>
								<a data-toggle="tooltip" title="已下架"><i class="fa fa-arrow-down"></i></a>
							</if>

					</td>
					<td>
						<a href="{:U('Sale/edit',array('id'=>$vo['id'],'p'=>$p))}">编辑</a> |
						<a href="{:U('Sale/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">删除</a> |
						<if condition="$vo.shop_status eq 1">
							<a href="{:U('Sale/ban',array('id'=>$vo['id']))}" class="js-ajax-delete">下架</a>
						<else/>
							<a href="{:U('Sale/cancelban',array('id'=>$vo['id']))}" class="js-ajax-delete">上架</a>
						</if>
					</td>
				</tr>
				</foreach>
				<tfoot>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th width="50">排序</th>
						<th width="50">ID</th>
						<th>商品名称</th>
						<th width="160">图片</th>
						<th width="160">商品分类</th>
						<th width="50">上传人</th>
						<th>原价</th>
						<th>现价</th>
						<th width="50">库存</th>
						<th width="50">销量</th>
						<th width="120">发布时间</th>
						<th width="50">状态</th>
						<th width="70">操作</th>
					</tr>
				</tfoot>
			</table>
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Sale/listorders')}">排序</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('Sale/delete')}" data-subcheck="true" data-msg="你确定删除吗？">删除</button>
			</div>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/js/dist/css/bootstrap-select.css">
	<script src="__PUBLIC__/js/dist/js/bootstrap-select.min.js"></script>
</body>
</html>